package de.g18.it0a.jlaser.nativ.menu.util;

import de.g18.it0a.jlaser.nativ.menu.MenuEntry;


public class MenuPrinter {

    private static MenuPrinter instance;


    private MenuPrinter() {
    }

    public static MenuPrinter getInstance() {
        if (instance == null) {
            createInstance();
        }
        return instance;
    }

    private static synchronized void createInstance() {
        if (instance != null) {
            return;
        }
        instance = new MenuPrinter();
    }

    public <E extends Enum<?> & MenuEntry> void print(Class<E> aMenuClass) {
        for (Enum<?> entry : aMenuClass.getEnumConstants()) {
            MenuEntry menuEntry = (MenuEntry) entry;
            System.out.println("# " + menuEntry.getOrdinal() + ". " + menuEntry.getText());
        }
    }
}
